﻿namespace ObjetoNegocio
{
    public class Usuario : IObject
    {
        public string Nome { get; set; }
        public decimal Codigo { get; set; }
        public string Login { get; set; }
        public string Senha { get; set; }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (Usuario)) return false;
            return Equals((Usuario) obj);
        }

        public bool Equals(Usuario obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            return obj.Codigo == Codigo;
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = (Nome != null ? Nome.GetHashCode() : 0);
                result = (result*397) ^ Codigo.GetHashCode();
                result = (result*397) ^ (Login != null ? Login.GetHashCode() : 0);
                result = (result*397) ^ (Senha != null ? Senha.GetHashCode() : 0);
                return result;
            }
        }
    }
}
